import { http } from '@/utils/request';


/**
 * 获取商品评论列表
 * @param goodsId
 * @param params
 */
export function getGoodsComments(goodsId: string, params: any) {
  return http.request({
    url: `/member/evaluation/${goodsId}/goodsEvaluation`,
    method: "GET",
    params,
  });
}

/**
 * 获取商品评论数量统计
 * @param goodsId
 */
export function getGoodsCommentsCount(goodsId: string) {
  return http.request({
    url: `/member/evaluation/${goodsId}/evaluationNumber`,
    method: "GET",
  });
}


/**
 * 获取店铺分类
 * @param id
 */
export function getStoreCategory(id: string) {
  return http.request({
    url: `/store/store/label/get/${id}`,
    method: "GET",
  });
}

/**
 * 获取店铺基本信息
 * @param storeId
 */
export function getStoreDetail(storeId: string) {
  return http.request({
    url: `/store/store/get/detail/${storeId}`,
    method: "GET",
  });
}

/**
 * 获取商品详情
 * @param skuId 商品ID
 * @returns {AxiosPromise}
 */
export function getGoodsDetail(skuId: string, goodsId: string) {
  return http.request({
    url: `/goods/goods/sku/${goodsId}/${skuId}`,
    method: "GET",
  });
}

/**
 * 获取商品分销
 * @param distributionId 商品分销ID
 */
export function getGoodsDistribution(distributionId: string | number) {
  return http.request({
    url: `/distribution/bindingDistribution/${distributionId}`,
    method: "GET",
  });
}

/**
 * 获取首页商品分类 左侧列表
 * @param parent_id
 */
export function getCategoryList(id: string) {
  return http.request({
    url: `/goods/category/get/${id}`,
    method: "GET",
  });
}


/**
 * 获取热门关键词
 * @param num
 */
export function getHotKeywords(count: number) {
  return http.request({
    url: "/goods/goods/hot-words",
    method: "GET",
    params: { count },
  });
}

/**
 * 从ES中获取相关商品品牌名称，分类名称及属性
 */
export function getGoodsRelated(params: any) {
  return http.request({
    url: `/goods/goods/es/related`,
    method: "GET",
    params,
  });
}


/**
 * 获取商品列表
 * @param params
 * @returns {AxiosPromise}
 */
export function getGoodsList(params: any) {
  return http.request({
    url: "/goods/goods/es",
    method: "GET",
    params,
  });
}

/**
 * 获取当前会员的分销商信息 可根据分销商信息查询待提现金额以及冻结金额等信息
 */
export function distribution() {
  return http.request({
    url: `/distribution`,
    method: "GET",
  });
}

/**
 * 分销中心首页信息
 */
export function distributionHome() {
  return http.request({
    url: `/distribution/order/statistics`,
    method: "GET",
  })
}

/**
 * 申请分销商
 * */
export function applyDistribution(params?: any) {
  return http.request({
    url: `/distribution`,
    method: "POST",
    params,
  });
}

/**
 * 获取分销商商品列表
 */
export function distributionGoods(params: any) {
  return http.request({
    url: `/distribution/goods`,
    method: "GET",
    params,
  });
}

/**
 * 获取 小程序码
 */
export function getMpCode(params: any) {
  return http.request({
    url: `/passport/connect/mini-program/mp/unlimited`,
    method: "GET",
    params
  })
}

/**
 * 促销订单
 */
export function distributionOrders(params: any) {
  return http.request({
    url: `/distribution/order`,
    method: "GET",
    params,
  });
}

/**
 * 我的客户
 */
export function distributionMemberList(params: any) {
  return http.request({
    url: `/distribution/memberList`,
    method: "GET",
    params
  })
}

/**
 * 我的团队
 */
export function distributionGroupList(params: any) {
  return http.request({
    url: `/distribution/groupList`,
    method: "GET",
    params
  })
}

/**
 * 分销商提现
 */
export function cash(params: any) {
  return http.request({
    url: `/distribution/cash`,
    method: "POST",
    params,
  });
}

/**
 * 分销商提现历史
 */
export function cashLog(params: any) {
  return http.request({
    url: `/distribution/cash`,
    method: "GET",
    params
  });
}

/**
 * 获取分销商分页订单列表
 */
export function distributionOrderList(params: any) {
  return http.request({
    url: `/distribution/distribution/distributionOrder`,
    method: "GET",
    params
  });
}
